package com.xyzq.service.ya.impl;

import java.util.Date;
import java.util.HashMap;
import java.util.List;

import org.appfuse.service.impl.GenericManagerImpl;

import com.xyzq.dao.ya.AccountDAO;
import com.xyzq.model.ya.data.Account;
import com.xyzq.service.ya.AccountManager;

public class AccountManagerImpl extends GenericManagerImpl<Account, Long>
		implements AccountManager {

	private AccountDAO accountDao;

	public AccountManagerImpl(AccountDAO accountDao) {
		super(accountDao);
		this.setAccountDao(accountDao);
	}

	public void setAccountDao(AccountDAO accountDao) {
		this.accountDao = accountDao;
	}

	public AccountDAO getAccountDao() {
		return accountDao;
	}

	public Account findByAccountId(Integer accountId) {
		// TODO Auto-generated method stub
		return this.accountDao.findByAccountId(accountId);
	}

	public HashMap<Integer, Account> findAllAccountMap() {
		// TODO Auto-generated method stub
		List<Account> list = this.accountDao.getAll();
		HashMap<Integer, Account> accountMap = new HashMap<Integer, Account>();
		for (Account account : list) {
			accountMap.put(account.getAccount(), account);
		}
		return accountMap;
	}

	public List<Account> findAccountByDate(Date start, Date end) {
		// TODO Auto-generated method stub
		return this.accountDao.findAccountWithDate(start, end);
	}

	public List<Account> findShAccountByDate(Date start, Date end) {
		// TODO Auto-generated method stub
		return this.accountDao.findShAccountWithDate(start, end);
	}

	public List<Account> findSzAccountByDate(Date start, Date end) {
		// TODO Auto-generated method stub
		return this.accountDao.findSzAccountWithDate(start, end);
	}

	public List<Account> findByAccountOrName(Integer account, String name) {
		// TODO Auto-generated method stub
		return this.accountDao.findByAccountOrName(account, name);
	}

}
